package com.visionblue.business.ship.model.repository.db

import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.visionblue.business.ship.model.repository.DeviceInfoRepository

/**
 * @author: xlh
 * @date: 2020-06-15 4:39 PM
 * @desc:
 */
class Migration1_2(private val deviceInfoRepository: DeviceInfoRepository) : Migration(1, 2) {

    override fun migrate(database: SupportSQLiteDatabase) {
        database.execSQL("ALTER TABLE cached_order ADD COLUMN sn TEXT default \'${deviceInfoRepository.sn}\'")
    }
}

object Migration2_3 : Migration(2, 3) {

    override fun migrate(database: SupportSQLiteDatabase) {
        database.execSQL("CREATE TABLE measure_menu_items(id INTEGER PRIMARY KEY AUTOINCREMENT, alias TEXT," +
                "name TEXT NOT NULL, isOutput INTEGER NOT NULL, isChecked INTEGER NOT NULL)")

    }
}